require "Dialogs"
Arena.ResizeImmediate(565, 130)

timer = 0
Player.sprite.alpha = 0

function Update()
	DialogUpdate()
	if timer == 0 then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Dialog("[noskip]GANASTE!\nObtuviste 1 XP y 0 de oro.", {X = 91, Y = 210}, nil, true, 1)
		else
			Dialog("[noskip]YOU WON!\nYou earned 1 XP and 0 gold.", {X = 91, Y = 210}, nil, true, 1)
		end
		timer = 1
	elseif timer == 1 and Dialogues[1] and not Dialogues[1].Activo then
		if string.sub(GetAlMightyGlobal("Archivimentazo"), 8, 8) == "0" then
			SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 7).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 9))
			Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 8}
		end
		Encounter["nextwaves"] = {"Overworld/Battle"}
		Encounter.Call("ConfigurateKR", {true, false})
		State("DEFENDING")
	end
end